package service;

import java.util.List;

import bean.GoodsImg;
import bean.GoodsImgRowMapper;
import bean.ProductAttr;
import bean.ProductAttrRowMapper;
import common.BaseDAO;

public class GoodsImgDAO extends BaseDAO{
	//根据goodsid获取对应的商品图片
	public List<GoodsImg> queryGoodsImg(int goodsid){
		String sql="select * from goods_img where goodsid=?";
		return this.query(sql, new GoodsImgRowMapper(), goodsid);
	}
	
	//根据attrValueid获取对应goodsid的商品图片
	public List<GoodsImg> queryGoodsImgByAttrValueid(int attrValueid){
		String sql="select * from goods_img where goodsid=any(select goodsid from goods_allocation where attr_valueid=?)";
		return this.query(sql, new GoodsImgRowMapper(), attrValueid);
	}
}
